package com.ktgj.flight.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.flight.domain.DeliverAssignRecord;
import com.ktgj.flight.service.IDeliverAssignRecordService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 机票预订_机票订单配送记录Controller
 * 
 * @author ruoyi
 * @date 2021-10-26
 */
@ControllerAdvice
@RestController
@RequestMapping("/record")
public class DeliverAssignRecordController extends BaseController
{
    @Autowired
    private IDeliverAssignRecordService deliverAssignRecordService;

    /**
     * 查询机票预订_机票订单配送记录列表
     */
    @PreAuthorize(hasPermi = "flight:record:list")
    @GetMapping("/list")
    public TableDataInfo list(DeliverAssignRecord deliverAssignRecord)
    {
        startPage();
        List<DeliverAssignRecord> list = deliverAssignRecordService.selectDeliverAssignRecordList(deliverAssignRecord);
        return getDataTable(list);
    }

    /**
     * 导出机票预订_机票订单配送记录列表
     */
    @PreAuthorize(hasPermi = "flight:record:export")
    @Log(title = "机票预订_机票订单配送记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DeliverAssignRecord deliverAssignRecord) throws IOException
    {
        List<DeliverAssignRecord> list = deliverAssignRecordService.selectDeliverAssignRecordList(deliverAssignRecord);
        ExcelUtil<DeliverAssignRecord> util = new ExcelUtil<DeliverAssignRecord>(DeliverAssignRecord.class);
        util.exportExcel(response, list, "机票预订_机票订单配送记录数据");
    }

    /**
     * 获取机票预订_机票订单配送记录详细信息
     */
    @PreAuthorize(hasPermi = "flight:record:query")
    @GetMapping(value = "/{deliverAssignRecordId}")
    public AjaxResult getInfo(@PathVariable("deliverAssignRecordId") Long deliverAssignRecordId)
    {
        return AjaxResult.success(deliverAssignRecordService.selectDeliverAssignRecordById(deliverAssignRecordId));
    }

    /**
     * 新增机票预订_机票订单配送记录
     */
    @PreAuthorize(hasPermi = "flight:record:add")
    @Log(title = "机票预订_机票订单配送记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DeliverAssignRecord deliverAssignRecord)
    {
        return toAjax(deliverAssignRecordService.insertDeliverAssignRecord(deliverAssignRecord));
    }

    /**
     * 修改机票预订_机票订单配送记录
     */
    @PreAuthorize(hasPermi = "flight:record:edit")
    @Log(title = "机票预订_机票订单配送记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DeliverAssignRecord deliverAssignRecord)
    {
        return toAjax(deliverAssignRecordService.updateDeliverAssignRecord(deliverAssignRecord));
    }

    /**
     * 删除机票预订_机票订单配送记录
     */
    @PreAuthorize(hasPermi = "flight:record:remove")
    @Log(title = "机票预订_机票订单配送记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{deliverAssignRecordIds}")
    public AjaxResult remove(@PathVariable Long[] deliverAssignRecordIds)
    {
        return toAjax(deliverAssignRecordService.deleteDeliverAssignRecordByIds(deliverAssignRecordIds));
    }
}
